package cn.wsalix.constant;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import cn.anlaser.exception.NutException;
import cn.wsalix.admin.entity.SysDict;
import cn.wsalix.config.AppConfig;
import cn.wsalix.config.SysConfig;
import cn.wsalix.msg.entity.Notice;

@Component("global")
@Data
@EqualsAndHashCode(exclude = {}, callSuper = false)
@ToString(exclude = {})
public class Global {
	public static final String HOST_PATH = "http://%s:%s/%s";
	public static final String hello = "hello jskyme";
	public static final int pageSize = 20;

	public static final String ADMIN_ROLE = "admin";
	public static final String CLIENT_ROLE = "client";
	
	public static final String userSupport = "support";
	public static final String userFocus = "focus";
	public static final String userGroup = "group";
	public static final String userPhone = "phone";
	public static final String userFriend = "friend";
	
	public static String companyNotice = "company_notice";
	public static String rwNotice = "rw_notice";
	
	public static String companyDynamic ="company_dynamic";
	public static final String CHANNEL = "channel";
	
	public static final Integer friended = 1;
	public static final Integer applyFriend = 0;
	public static final Integer unFriend = -1;
	
	public static final Integer focused = 1;
	public static final Integer unfocus = -1;
	
	public static final int READED = 0;
	public static final int UN_READ = 1;
	//
	public static final String AD_URL = "0";
	public static final String AD_NOTICE = "1";
	public static final String AD_TOPIC = "2";
	
	public static final String SITE_ID = "site_id";
	
/*	<option selected="selected" value="0">url</option>		                                    
    <option value="1">置业公告</option>
    <option value="2">帖子</option>*/
	public static ApplicationContext springContext;
	public static SysDict parentException;
	public static Map<String, NutException> excepInsts;
	public static String urlSuffix;
	public static AppConfig appConfig;
	public static SysConfig sysConfig;
	public static String uploadDir;
	public static String uploadHttp;
	// public static FileServerConfig fsConfig;
	public static String SORT_SER_NO = "serNo";
	/*
	 * public static String siteTempletPath; public static String templetPath;
	 */

	public static String qqAppId;
	public static String qqAppKey;
	public static String qqServerName;

	public static String wxAppId;
	public static String wxMchId;
	public static String wxTradeType;
	public static String wxNotifyUrl;
	public static String wxPayKey;
	public static Notice lastNotice;// 最后一条通知
	public static AtomicInteger wxUserCount;

	public static NutException getException(String code, String message) {
		return new NutException(message);
	}

	public static Object getBean(String beanName) {
		return springContext.getBean(beanName);
	}

	public static void setSpringContext(ApplicationContext applicationContext) {
		springContext = applicationContext;
	}
}
